Imports System.Threading
Imports System.Diagnostics

Module ListThreads
    Public A As Thread
    Public B As Thread
    Public C As Thread
    Public D As Thread

    Sub Display()
        D.Join()
    End Sub

    Sub ThreadInfo()
        Dim List As ProcessThreadCollection
        List = Process.GetCurrentProcess().Threads()
        Dim objThread As ProcessThread
        For Each objThread In List
            Console.Write("Thread: {0:D5}", objThread.Id)
            Console.Write(" Start: {0}", objThread.StartTime)
            Console.WriteLine(" CPU Time: {0}", objThread.TotalProcessorTime)
            Console.Write(" State: {0}", objThread.ThreadState)
            If (objThread.ThreadState = System.Diagnostics.ThreadState.Wait) Then
                Console.Write("Reason: {0}", objThread.WaitReason())
            End If
            Console.WriteLine(" Address: {0}", objThread.StartAddress())
        Next
    End Sub
    Sub Main()

        D = New Thread(AddressOf ThreadInfo)
        A = New Thread(AddressOf Display)
        B = New Thread(AddressOf Display)
        C = New Thread(AddressOf Display)

        A.Name = "A"
        B.Name = "B"
        C.Name = "C"
        D.Name = "D"

        A.Start()
        B.Start()
        C.Start()
        D.Start()

        Console.ReadLine()  
    End Sub

End Module
